package container.lis;

import java.util.LinkedList;

public class TestLinkedList2
{
    public static void main (String[] args)
    {
        LinkedList<String> linkedList = new LinkedList<>();
        
        linkedList.addFirst("第一个");
        linkedList.addLast("最后一个");
        System.out.println(linkedList.getFirst());
        System.out.println(linkedList.getLast());
    
        System.out.println();
        
        String linkedListFirst = linkedList.removeFirst();
        System.out.println(linkedListFirst);
        
        String linkedListLast = linkedList.removeLast();
        System.out.println(linkedListLast);
    
        System.out.println();
    
        linkedList.addFirst("第一个");
        linkedList.addLast("最后一个");
        
        String popFirst = linkedList.pop();
        System.out.println(popFirst);
    
        System.out.println();
        
        linkedList.push("666");
    
        for(String temp : linkedList)
        {
            System.out.println(temp);
        }
    }
}
